<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" template="template.xhtml">

	<ui:define name="head"></ui:define>
	<ui:define name="right"></ui:define>
	<ui:define name="content">

		<f:metadata>
			<f:event type="preRenderView"
				listener="#{usuarioMB.iniciarNovoRegistro}" />
		</f:metadata>

		<p:growl id="growl" showDetail="true" sticky="true" />

		<p:panel id="panel1" header="Dados Pessoais"
			style="margin-bottom:10px;">

			<h:form id="pessoaForm" prependId="false">
				<f:validateBean disabled="true">

					<p:messages />
					<h:panelGrid columns="3">
						<h:outputLabel styleClass="bold" for="nome" value="#{msgs.form_nome}: *" />
						<p:inputText id="nome" value="#{usuarioMB.pessoaFisica.nome}"
							label="nome" />
						<p:message for="nome" />
						<h:outputLabel styleClass="bold" for="dataNascimento"
							value="#{msgs.form_data_nascimento}: *" />
						<p:calendar id="dataNascimento" navigator="true"
							value="#{usuarioMB.pessoaFisica.dataNascimento}" showOn="button"
							pattern="dd/MM/yyyy" yearRange="1900" />
						<p:message for="dataNascimento" />
						<h:outputLabel styleClass="bold" for="sexo" value="#{msgs.form_sexo} *" />
						<p:selectOneMenu id="sexo" value="#{usuarioMB.pessoaFisica.sexo}"
							var="sexo" converter="tcConverter">
							<f:selectItem itemLabel="#{msgs.form_selecione}" itemValue="" />
							<f:selectItems value="#{usuarioMB.tipoSexos}" itemValue="#{s}"
								itemLabel="#{s.descricao}" var="s" />
							<p:column>#{sexo.descricao}</p:column>
						</p:selectOneMenu>
						<p:message for="sexo" />
						<h:outputLabel styleClass="bold" for="cpf" value="#{msgs.form_cpf}: *" />
						<p:inputMask mask="999.999.999-**" id="cpf"
							value="#{usuarioMB.pessoaFisica.cpf}" label="cpf"
							converter="cpfConverter" />
						<p:message for="cpf" />
						
						<h:outputLabel styleClass="bold" for="rg" value="#{msgs.form_rg}: *" />
						<p:inputText id="rg" value="#{usuarioMB.rg.numero}"
							label="rg" />
						<p:message for="rg" />
						
						<h:outputLabel styleClass="bold" for="rgComp"
							value="#{msgs.form_orgao_expedidor}: *" />
						<p:inputMask mask="***/**" id="rgComp"
							value="#{usuarioMB.rg.complemento}" required="true"
							label="rgComp" />
						<p:message for="rgComp" />
						
						<h:outputLabel styleClass="bold" for="tituloEleitor"
							value="#{msgs.form_titulo_eleitor}: *" />
						<p:inputText id="tituloEleitor"
							value="#{usuarioMB.tituloEleitor.numero}" required="true"
							label="tituloEleitor" />
						<p:message for="tituloEleitor" />
						
						<h:outputLabel styleClass="bold" for="tel" value="#{msgs.form_telefone}: *" />
						<p:inputMask id="tel" mask="(99) 9999-9999"
							value="#{usuarioMB.telefone.numero}" label="tel" />
						<p:message for="tel" />
						
						<h:outputLabel styleClass="bold" for="cel" value="#{msgs.form_celular}: *" />
						<p:inputMask id="cel" mask="(99) 9999-9999"
							value="#{usuarioMB.celular.numero}" label="cel" />
						<p:message for="cel" />
						
						<h:outputLabel styleClass="bold" for="email" value="#{msgs.form_email}: *" />
						<p:inputText id="email" value="#{usuarioMB.email.descricao}"
							label="email" />
						<p:message for="email" />

						<h:outputLabel styleClass="bold" for="senha" value="#{msgs.form_senha}: *" />
						<p:password id="senha" value="#{usuarioMB.usuario.senha}"
							promptLabel="Digite a senha" weakLabel="Fraco" goodLabel="Bom"
							strongLabel="Forte" />
						<p:message for="senha" />

						<h:outputLabel styleClass="bold" for="#{msgs.form_confirma_senha}"
							value="Confirma a Senha: *" />
						<p:password id="confSenha" value="#{usuarioMB.confSenha}"
							feedback="false" />
						<p:message for="confSenha" />
						<p:commandButton value="Registrar" id="registrar"
							styleClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
							actionListener="#{usuarioMB.registrar}" update="growl" />

					</h:panelGrid>
				</f:validateBean>
				<h:link value="#{msgs.login}" outcome="login.jsf" /> | 
				<h:link value="#{msgs.recuperar_senha}" outcome="recuperar_senha.jsf" />
				 
			</h:form>
		</p:panel>
		<div class="clearer"></div>
	</ui:define>

</ui:composition>